﻿using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using ZeroAdmin.Application.Entity;
using ZeroAdmin.Application;


namespace ZeroAdmin.Web.Core;

/// <summary>
/// 系统配置服务
/// </summary>
/// <param name="service"></param>
[ApiDescriptionSettings("SystemOperate", Name = "SysConfig", Order = 0, Tag = "系统配置")]
public class SysConfigController(ISysConfigService service) : IDynamicApiController
{
    private readonly ISysConfigService _service = service;

    /// <summary>
    /// 依据条件获取单条系统配置信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<SysConfig> Get([FromQuery] QuerySysConfigInput input)
    {
        return await _service.Get(input);
    }

    /// <summary>
    /// 依据条件获取多条系统配置信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<IEnumerable<SysConfig>> GetList([FromQuery] QuerySysConfigInput input)
    {
        return await _service.GetList(input);
    }

    /// <summary>
    /// 添加配置信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<long> Add(EditSysConfigInput input)
    {
        return await _service.Add(input);
    }

    /// <summary>
    /// 更新配置信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Update(EditSysConfigInput input)
    {
        await _service.Update(input);
    }

    /// <summary>
    /// 删除配置信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public async Task Delete(long id)
    {
        await _service.Delete(id);
    }
}
